import dayjs from 'dayjs'

const bizTool = {}

//非工作流获取审批人
bizTool.obtainApprover = (record) => {
	return record.approveUserName || ''
}

bizTool.obtainApproverTime = (record) => {
	if (record.approveTime) {
		return dayjs(record.approveTime).format('YYYY-MM-DD HH:mm')
	}
	return ''
}
//非工作流获取操作人/修改人
bizTool.obtainCreateUser = (record) => {
	return record.updateUserName || record.createUserName
}

bizTool.obtainCreateTime = (record) => {
	let time = record.updateTime || record.createTime
	return dayjs(time).format('YYYY-MM-DD HH:mm')
}

bizTool.getReviewStatus = () => {
	return [
		{
			label: '待审核',
			value: '待审核'
		},
		{
			label: '审核成功',
			value: '审核成功'
		},
		{
			label: '审核拒绝',
			value: '审核拒绝'
		}
	]
}
bizTool.audit = '待审核'
bizTool.reviewReject = '审核拒绝'
bizTool.reviewPass = '审核通过'
bizTool.productName = '产品'
export default bizTool
